/**
 * Created with Intellij IDEA.
 * Description:
 * User: wangj
 * Date: 2022-02-18
 * Time: 20:11
 */
public class TestDemo {
    public static int sumFunc(int n){
        if(n<10){
            return n;
        }
        else{
            return n%10+sumFunc(n/10);
        }
    }
    public static void main(String[] args) {
        int ret=sumFunc(123);
        System.out.println(ret);
    }
    public static void print(int n) {
        if(n==1){
            System.out.print(n+" ");
        }
        else{
            print(n-1);
            System.out.print(n+" ");
        }
    }
    public static void main2(String[] args) {
        print(9);
    }
}
